﻿//lua头文件  
#ifdef __cplusplus  
extern "C" {
#include "K:/lua-5.4.1/src/lua.h"
#include "K:/lua-5.4.1/src/lauxlib.h"
#include "K:/lua-5.4.1/src/lualib.h"    
}
#else  
#include "K:/lua-5.4.1/src/lua.h"
#include "K:/lua-5.4.1/src/lauxlib.h"
#include "K:/lua-5.4.1/src/lualib.h" 
#endif 

#include<iostream>
using  namespace std;

// Macro to define cursor lines
#define CURSOR(top, bottom) (((top) << 8) | (bottom))

// Macro to get a random integer with a specified range
#define getrandom(min, max) \
    ((rand()%(int)(((max) + 1)-(min)))+ (min))

#define pre
#define may
#define Add pre may



int main()
{

	int a = 1;
	int b = 0;
	while (a>0)
	{
		a = a << 1;
		++b;
	}
	printf("int 最小值 ： %d\n",a);
	printf("int 最大值 ： %d\n", a-1);
	printf("b: %d \n", b);
	long aa = 1;
	while (aa>0)
	{
		aa = aa << 1;
	}
	printf("long int 最小值 ： %d\n", aa);
	printf("long int 最大值 ： %d\n", aa-1);

	/*int c = (int)pow(2, 31);
	printf("c  ::  %d\n", c);

	int d = (int)pow(2, 63);
	printf("d  ::  %d\n", d);*/

	//cout << CURSOR(10, 1) << endl;
	//cout << getrandom(1, 5) << endl;

	////1.创建一个State
	lua_State* L = luaL_newstate();
	luaL_openlibs(L);
	luaL_dofile(L, "test.lua");
	////2.入栈操作
	//lua_pushstring(L, "I am so beautiful");
	//lua_pushnumber(L, 10);
	////3.取消操作
	//if (lua_isstring(L, 1))
	//{
	//	//printf(lua_tostring(L, 1));
	//	cout << lua_tostring(L, 1) << endl;
	//}
	//if (lua_isnumber(L, 2))
	//{
	//	int a = lua_tonumber(L, 2);
	//	//printf("\n%d\n",a);
	//	cout << lua_tonumber(L, 2) << endl;
	//}
	
	////4.关闭state
	//lua_close(L);
	//system("pause");
	return 0;
}


